package com.hmall.item.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hmall.common.dto.Item;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface ItemMapper extends BaseMapper<Item> {
    /**
     * 功能描述: 减少库存
     * @return :
     * @param id
     * @param num
     */
    @Update("UPDATE test02.tb_item set stock=stock-#{num} where id = #{id}")
    Integer stockMinus(@Param("id") Long id,@Param("num") Long num);
    /**
     * 功能描述: 添加库存
     * @return :
     * @param id
     * @param num
     */
    @Update("UPDATE test02.tb_item set stock=stock+#{num} where id = #{id}")
    Integer stockAdd(@Param("id") Long id,@Param("num") Long num);

//    List<Item> selectByIdList(Integer id);
}
